package cn.dengta.webapp.user.vo;

import javax.annotation.Nullable;

import cn.dengta.webapp.base.entity.I18nContent;
import cn.dengta.webapp.base.vo.AbstractVO;
import cn.dengta.webapp.user.entity.ComplainType;
import cn.dengta.webapp.user.entity.ComplainType.BizType;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import me.codeplayer.util.X;

@Setter
@Getter
@Accessors(chain = true)
public class ComplainTypeVO extends AbstractVO<ComplainType> {

	/** 内容 */
	private Object name;
	/** 0-用户，1-动态 2-语聊 3-视频 */
	private BizType type;
	/** 排序 */
	private Integer sort;

	public static ComplainTypeVO from(@Nullable ComplainType source) {
		ComplainTypeVO vo = copy(source, ComplainTypeVO::new);
		if (vo != null) {
			vo.name = X.map(source.getResolvedLanguageCfg(), I18nContent::getDataMap);
		}
		return vo;
	}

	public Integer getType() {
		return type.ordinal();
	}

	public String getType_() {
		return X.map(type, BizType::getLabel);
	}

}
